perm filename CMBASE.MF[MF,DEK]2 blob
sn#470948 filedate 1979-08-29 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00003 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 eps=.000314159 % a very small random positive number
C00008 00003 subroutine serif(index i) %point where serif appears
C00015 ENDMK
C⊗;
eps=.000314159; % a very small random positive number
if mode=0: proofmode; drawdisplay; pixels=36; blacker=0;
else: if mode=1: fntmode; tfxmode; chardisplay; pixels=3.6; blacker=1.2;
else: crsmode; tfxmode; titletrace; pixels=73.7973; blacker=1;
fi;
fi.
subroutine fontbegin: % Initialize before making a font:
no eqtrace; % Turn off tracing within this subroutine.
new typesize; % the vertical size of the font
new cf; % conversion factor, approximately equal to pixels
new h,d,c,e,o,b,s,a; % raster-oriented vertical dimensions
w0=round(pixels.pw+blacker);
w1=round(pixels.pwi+blacker);
w2=round(pixels.pwii+blacker);
w3=round(pixels.pwiii+blacker);
w4=round(pixels.pwiv+blacker);
w5=round(pixels.pwv+blacker);
w6=round(pixels.pw/aspect+blacker);
w7=round(pixels.pwi/aspect+blacker);
w8=round(pixels.pwiv/aspect+blacker);
hpenht w6; vpenwd w0;
typesize=ph+pd+2pb; cf.typesize=pixels.typesize-1;
h=round cf.ph; d=round cf.pd;
c=round cf.px;
o=round cf.po; s=cf.ps;
a=.5 round 2cf.pa;
b=-round(.5(h+d-typesize.pixels));
hpen; e=good0 cf.pe;
maxht h+b;
trxy slant;
if mode≠0: texinfo slant,6pu,3pu,3pu,px,18pu,2pu;
fi.
subroutine charbegin(var charno) %seven-bit character code
(var charuw) %character width in units
(var lftcorr, var rtcorr) %serif-oriented corrections in units
(var charh, var chard, var chari): %charht, chardp, charic values in points
no eqtrace; no calltrace; % Shut off tracing in this subroutine.
new uw; % the correct character width in units
new r; % raster-oriented character width
new u; % raster-oriented design unit
new tu; % unmodified raster-oriented unit
new italcorr; % italic correction
if chari≥0: italcorr=chari; else: italcorr=0;
fi;
charcode charno; charht charh; chardp chard; charic italcorr;
tu=pu.pixels;
if fixwidth=0: r+2=round charuw.tu; uw=charuw-sc.(lftcorr+rtcorr);
else: r+2=round((9+sc.(lftcorr+rtcorr)).tu); uw=9;
fi;
u.charuw=r;
charwd uw.pu; chardw uw.tu;
incx round(-sc.lftcorr.tu);
if mode=0: call box(round sc.lftcorr.tu);
fi.
subroutine box(var offset): % Draw guildelines and box around a character:
no drawtrace; no proofmode;
new topp,bott,left,right,pos;
topp=h+b; bott=-d-b;
left=offset; right=offset+u.uw;
x1=x3=x5=x7=x9=x11=x13=x15=x17=left;
x2=x4=x6=x8=x10=x12=x14=x16=x18=right;
y1=y2=0; cpen; 1 draw1..2; % baseline
y3=y4=e; draw3..4; % e-height
y5=y6=c; draw5..6; % x-height
y7=y8=h; draw7..8; % h-height
y9=y10=topp; draw9..10; % top of character
y11=y12=-d; draw11..12; % descender line
y13=y14=bott; draw13..14; % bottom of character
trxy 0; % Temporarily turn off the slant.
y15=y16=topp; y17=y18=bott;
draw15..17; draw16..18; % left and right edges
if italcorr>0: x19=x20=right+italcorr.pixels;
y19=topp; y20=0; draw19..20; % show italic correction
fi;
trxy slant; % Restore slanted transformation
pos=0; call unitlines. % Draw the unit guidelines.
subroutine unitlines: % Recursive subroutine to draw guidelines:
x1=x2=pos;y1=topp;y2=bott;cpen;
if pos≥left: 1 draw1..2;
fi;
new pos; pos=x1+u; if pos≤right: call unitlines; fi.
subroutine serif(index i) %point where serif appears
(index k) %w-variable for stem line
(index j) %another point on the stem line
(var sl): %serif length
y1=yi;
if yi<yj: y2=yi+s; else: y2=yi-s;
fi;
hpen;
if sl<0: lft0x1=lft k xi+sl.u-eps;
lft0x2=lft k (y2-yi)/(yj-yi)[xi,xj];
else: rt0x1=rt k xi+sl.u+eps;
rt0x2=rt k (y2-yi)/(yj-yi)[xi,xj];
fi;
no proofmode;
x3=1/3[x1-sl.u,1/2[x1,x2]];
y3=1/3[yi,1/2[y1,y2]];
minvr 0; minvs 0;
w0 ddraw 1{xi-x1,0}..3..2{xj-xi,yj-yi}, 1..1..i;
minvr 0.5; minvs 0.5.
subroutine darc(index i) %starting point
(index j) %opposite corner point
(var maxwidth): %the pen grows from w0 to this size
x5=xi; x2=x4=1/sqrttwo [xi,xj]; x3=xj;
y5=yj; y3=1/2[yi,yj];
y2=1/sqrttwo [y3,yi]; y4=1/sqrttwo [y3,yj];
hpen; draw |w0|i{x3-xi,0}..|2/3[w0,maxwidth]|2{x3-xi,y3-yi}..
|maxwidth#|3{0,y3-yi}..
|2/3[w0,maxwidth]|4{x5-x3,y5-y3}..|w0|5{x5-x3,0}.